﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace W03_UI.Model
{
    public class ModelContainer                            //主目录
    {
        public Model Model { get; set; }
        public string Id { get; set; }
        public DateTime UpdatedAt { get; set; }         //拧紧到位时间
        public DateTime CreatedAt { get; set; }         //开始拧紧时间，不含前期的旋入
    }
    public class Model
    {
        public int ResultNumber { get; set; }
        public Controller Controller { get; set; }
        public TighteningUnit TighteningUnit { get; set; }
        public PSet PSet { get; set; }
        public List<Identifier> Identifiers { get; set; }
        public List<Result> Results { get; set; }
        public string DivisionId { get; set; }
        public string DivisionName { get; set; }
        public string FactoryId { get; set; }
        public string FactoryName { get; set; }
        public string AssemblyLineId { get; set; }
        public string AssemblyLineName { get; set; }
        public string WorkingAreaId { get; set; }
        public string WorkingAreaName { get; set; }
        public string DeviceId { get; set; }
        public string VirtualDeviceId { get; set; }
        public string DeviceName { get; set; }
        public string DeviceType { get; set; }
        public string CompanyName { get; set; }
        public string report { get; set; }
        public string vin { get; set; }                    //工件二维码

    }
    public class Controller
    {
        public string Name { get; set; }
        public string Ip { get; set; }
        public string SerialNumber { get; set; }
        public int Type { get; set; }
    }
    public class TighteningUnit
    {
        public string Name { get; set; }
        public int Number { get; set; }
    }
    public class PSet
    {
        public string Comment { get; set; }
        public int Number { get; set; }               //程序号，对应钉编号
    }
    public class Identifier
    {
        public int Number { get; set; }
        public string Value { get; set; }
    }
    public class Result
    {
        public Tool Tool { get; set; }
        public List<Step> Steps { get; set; }
        public List<Curve> Curves { get; set; }
    }
    public class Tool
    {
        public int Number { get; set; }
        public string SerialNumber { get; set; }      //枪的序列号，与枪体上编号对应
    }
    public class Step
    {
        public Configuration Configuration { get; set; }
        public Data Data { get; set; }
    }

    public class Configuration
    {
        public float angleMaxTolerance { get; set; }
        public float angleMinTolerance { get; set; }
        public float torqueMaxTolerance { get; set; }
        public float torqueMinTolerance { get; set; }
        public float torqueTarget { get; set; }            //目标扭矩
    }
    public class Data
    {
        public float FinalAngle { get; set; }           //终角度
        public float FinalTorque { get; set; }          //终扭矩
        public int errorCode { get; set; }              //错误码
        public int stopSource { get; set; }             //停止原因
        public string report { get; set; }              //OK、NOK结果
    }
    public class Curve
    {
        public int PointDuration { get; set; }
        public CurveData Data { get; set; }
    }
    public class CurveData
    {
        public int PointCount { get; set; }
        public List<Point> Points { get; set; }
    }
    public class Point
    {
        public int PointIndex { get; set; }           //点序列
        public float Torque { get; set; }             //扭矩
        public float Angle { get; set; }              //角度
        public float TorqueRate { get; set; }          //扭矩比率
        public float Current { get; set; }            //电流
    }
}
